package com.caltco.cargo.ops.modules.sys.controller;

import com.caltco.cargo.ops.common.api.R2;
import com.caltco.cargo.ops.common.api.Result;
import com.caltco.cargo.ops.modules.sys.service.LevelValueService;
import com.caltco.cargo.ops.modules.sys.service.UserLevelService;
import com.caltco.cargo.ops.modules.sys.vo.LevelVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/level")
public class LevelValueController {
    private final LevelValueService levelValueService;
    private final UserLevelService userLevelService;

    public LevelValueController(LevelValueService levelValueService, UserLevelService userLevelService) {
        this.levelValueService = levelValueService;
        this.userLevelService = userLevelService;
    }

    @GetMapping("get")
    public Result<List<LevelVO>> getWordByType(@RequestParam("type") String type){
        return R2.ok(userLevelService.getLevel());
    }

    @GetMapping("getByOwn")
    public Result<LevelVO> getWordByType(){
        return R2.ok(userLevelService.getByOwn());
    }


}
